<script setup lang='ts'>
import { usePortfolioRebalancing } from "./hook/PortfolioRebalancing";
import { PureTableBar } from "@/components/RePureTableBar";
const {
  columns,
  loading,
  dataList,
  RiskEarly,
  CreditFrom,
  pagination,
  SERiskEarly,
  BtnLoading,
  btnloading,
  TransferTip,
  stubim_Visible,
  close_Visible,
  DialogVisible,
  handleSizeChange,
  handleCurrentChange
} = usePortfolioRebalancing()
</script>

<template>
  <div class="main">
    <PureTableBar class="list_hei">
      <template v-slot="{ size, checkList }">
        <pure-table border align-whole="center" showOverflowTooltip table-layout="auto" :loading="loading" size="small"
          max-height="600" :data="dataList" :columns="columns" :checkList="checkList" :pagination="pagination"
          @size-change="handleSizeChange" @current-change="handleCurrentChange" :header-cell-style="{
            background: 'var(--el-table-row-hover-bg-color)',
            color: 'var(--el-text-color-primary)'
          }">
          <template #operation="{ row }">
            <el-button type="primary" text size="small" :loading="btnloading" @click="TransferTip(row, 0)"
              :disabled="row.riskEarlyWarning !== ''"> 风险预警 </el-button>
            <el-button type="primary" text size="small" :loading="btnloading" @click="TransferTip(row, 1)"
              :disabled="row.warningType !== '0' || row.riskEarlyWarning == ''">
              调仓提示 </el-button>
          </template>
        </pure-table>
      </template>
    </PureTableBar>
    <ReDialog :width="380" :height="180" :models="DialogVisible" @Closes="close_Visible()">
      <template #header>
        <h2 style="text-align: center;">新建资产配置方案</h2>
      </template>
      <template #main>
        <div class="h-full flex justify-items-center items-center">
          <el-form-item label="风险预警" label-width="100">
            <el-select v-model="SERiskEarly">
              <el-option v-for="it in RiskEarly " :key="it.value" :label="it.label" :value="it.value" />
            </el-select>
          </el-form-item>
        </div>

      </template>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="stubim_Visible()" :loading="BtnLoading"> 确定 </el-button>
          <el-button @click="close_Visible()"> 取消 </el-button>
        </span>
      </template>
    </ReDialog>
  </div>
</template>

<style scoped lang="scss">
@import url(@/style/CreditComm.scss);

:deep(.el-dialog__footer) {
  text-align: center;
}
</style>
